<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <div class="box">
        <p>
            <span>222</span>
        </p>
        <h3>22222</h3>
    </div>

    <script>
        // remove() 删除自己
        // removeChild()  删除指定的子元素  ---   只能删除儿子，不能删除孙子
        // innerHTML = ''   清除所有的内容

        var oBox = document.querySelector('.box');

        // 删除整个box
        // oBox.remove();

        var oH3 = document.querySelector('h3');

        oBox.removeChild(oH3);


        var oSpan = document.querySelector('span');

        // oBox.removeChild(oSpan);   // 报错

        oBox.innerHTML = '';

    </script>

</body>

</html>